local UpPillar =class("UpPillar",function()  return CCSprite:create()  end)
function UpPillar:ctor()
 local part1 =display.newSprite("pillar1.png",0,0)
 local part2 =display.newSprite("pillar2.png",0,0)
 self:addChild(part1)
 self:addChild(part2)
 self.size1 =part1:getContentSize()
 local size2 =part2:getContentSize()
 local px,py =part1:getPosition()
 transition.rotateTo(part1, {rotate = 180,time=0})
 transition.rotateTo(part2, {rotate = 180,time=0})
 display.align(part2,display.CENTER,px-3,self.size1.height/2+size2.height/2)
 self.width =self.size1.width
 self.height =self.size1.height+size2.height
 part1:setTag(1)
 part2:setTag(2)
end
function UpPillar:fadeOut(d)
  transition.fadeOut(CCNode.getChildByTag(self,1),{time=d})
  transition.fadeOut(CCNode.getChildByTag(self,2),{time=d})
end
--设置图片中心位置到 x ,y 注意：Sprite中心点在part1上,而不是图片中心，
function UpPillar:setXY(x,y)
 display.align(self,display.CENTER,x, y-(self.height/2-self.size1.height/2))
end

function UpPillar:imgWidth()
  return self.width   
end

function  UpPillar:imgHeight()
  print("UpPillar height")
  return self.height
end
return UpPillar